package com.xuxueli.crawler.util;

import org.apache.http.cookie.Cookie;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: zmh
 * @create: 18-9-28
 * @description: ${cookie的工具类}
 **/
public class CookiesUtil {

    /**
     * 将cookie以其他形式Hashmap保存下来
     * @param cookies
     * @return
     */
    public static Map<String, String> ReadCookieMap(List<Cookie> cookies) {
        Map<String, String> cookieMap = new HashMap<String, String>();
        if (null != cookies) {
            for (Cookie cookie : cookies) {
                cookieMap.put(cookie.getName(), cookie.getValue());
            }
        }
        return cookieMap;
    }
}
